import org.jetbrains.annotations.NotNull;

import java.util.*;

public class testTreeSet {
    public static void main(String[] args) {
/**
 * // TODO: 2022-04-22 {@code Map hashmap没学 }
 */
        Map<Integer, String> map = new HashMap<>();
        List<Integer> list = new ArrayList<>();
        String[] colors = {"♣", "♠", "♦", "♥"};
        String[] number = {"3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A", "2"};
        Integer k = 0;
        for (int i = 0; i < number.length; i++) {
            for (int j = 0; j < colors.length; j++) {
                map.put(k, colors[j] + number[i]);
                list.add(k);
                k++;
            }
        }
        map.put(k, "小王");
        list.add(k);
        list.add(k + 1);
        map.put(k + 1, "大王");
        Collections.shuffle(list);
        TreeSet<Integer> G = new TreeSet<>();
        TreeSet<Integer> T = new TreeSet<>();
        TreeSet<Integer> C = new TreeSet<>();
        TreeSet<Integer> DP = new TreeSet<>();
        for (int i = 0; i < list.size(); i++) {
            if (i > list.size() - 4) {
                DP.add(list.get(i));
            } else if (i % 3 == 0) {
                G.add(list.get(i));
            } else if (i % 3 == 1) {
                T.add(list.get(i));
            } else if (i % 3 == 2) {
                C.add(list.get(i));
            }
        }
        review(G, "憨憨1", map);
        review(T, "憨憨2", map);
        review(C, "憨憨3", map);
        review(DP, "憨憨4", map);
    }

    public static void review(@NotNull TreeSet<Integer> TreeSet, String name, Map<Integer, String> map) {
        System.out.print(name + "的牌是:");
        for (Integer integer : TreeSet) {
            System.out.print(map.get(integer) + "  ");
        }
        System.out.println();
    }
}
